{"ast":null,"code":"import _regeneratorRuntime from\"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js\";import _asyncToGenerator from\"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";import _classCallCheck from\"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/classCallCheck.js\";import _createClass from\"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/createClass.js\";import apiClient from\"../http\";import{acceptContact as _acceptContact,addContact as _addContact,deleteContact as _deleteContact,getContacts as _getContacts}from\"../routes\";var ContactService=/*#__PURE__*/function(){function ContactService(){_classCallCheck(this,ContactService);}_createClass(ContactService,null,[{key:\"getContacts\",value:function(){var _getContacts2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){return _regeneratorRuntime().wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:return _context.abrupt(\"return\",apiClient.get(_getContacts()));case 1:case\"end\":return _context.stop();}}},_callee);}));function getContacts(){return _getContacts2.apply(this,arguments);}return getContacts;}()},{key:\"addContact\",value:function(){var _addContact2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(otherUserId){return _regeneratorRuntime().wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:return _context2.abrupt(\"return\",apiClient.get(_addContact(otherUserId)));case 1:case\"end\":return _context2.stop();}}},_callee2);}));function addContact(_x){return _addContact2.apply(this,arguments);}return addContact;}()},{key:\"acceptContact\",value:function(){var _acceptContact2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(contactId){return _regeneratorRuntime().wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:return _context3.abrupt(\"return\",apiClient.put(_acceptContact(contactId)));case 1:case\"end\":return _context3.stop();}}},_callee3);}));function acceptContact(_x2){return _acceptContact2.apply(this,arguments);}return acceptContact;}()},{key:\"deleteContact\",value:function(){var _deleteContact2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(contactId){return _regeneratorRuntime().wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:return _context4.abrupt(\"return\",apiClient.delete(_deleteContact(contactId)));case 1:case\"end\":return _context4.stop();}}},_callee4);}));function deleteContact(_x3){return _deleteContact2.apply(this,arguments);}return deleteContact;}()}]);return ContactService;}();export{ContactService as default};","map":{"version":3,"names":["apiClient","acceptContact","addContact","deleteContact","getContacts","ContactService","get","otherUserId","contactId","put","delete"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/src/services/ContactService.ts"],"sourcesContent":["import apiClient from \"../http\";\nimport {AxiosResponse} from 'axios';\nimport {acceptContact, addContact, deleteContact, getContacts} from \"../routes\"\nimport {ContactListResponse} from \"../models/response/ContactListResponse\";\nimport {ContactListItem} from \"../models/response/ContactListItem\";\nimport {DeleteContactResponse} from \"../models/response/Other/DeleteContactResponse\";\n\nexport default class ContactService {\n    public static async getContacts(): Promise<AxiosResponse<ContactListResponse>> {\n        return apiClient.get<ContactListResponse>(getContacts());\n    }\n\n    public static async addContact(otherUserId: string): Promise<AxiosResponse<ContactListItem>> {\n        return apiClient.get<ContactListItem>(addContact(otherUserId));\n    }\n\n    public static async acceptContact(contactId: string): Promise<AxiosResponse<ContactListItem>> {\n        return apiClient.put<ContactListItem>(acceptContact(contactId));\n    }\n\n    public static async deleteContact(contactId: string): Promise<AxiosResponse<DeleteContactResponse>> {\n        return apiClient.delete<DeleteContactResponse>(deleteContact(contactId));\n    }\n}"],"mappings":"skBAAA,MAAOA,UAAS,KAAM,SAAS,CAE/B,OAAQC,aAAa,GAAbA,eAAa,CAAEC,UAAU,GAAVA,YAAU,CAAEC,aAAa,GAAbA,eAAa,CAAEC,WAAW,GAAXA,aAAW,KAAO,WAAW,IAK1DC,eAAc,2OAC/B,qKACWL,SAAS,CAACM,GAAG,CAAsBF,YAAW,EAAE,CAAC,wDAC3D,4MAED,kBAA+BG,WAAmB,yJACvCP,SAAS,CAACM,GAAG,CAAkBJ,WAAU,CAACK,WAAW,CAAC,CAAC,0DACjE,iNAED,kBAAkCC,SAAiB,yJACxCR,SAAS,CAACS,GAAG,CAAkBR,cAAa,CAACO,SAAS,CAAC,CAAC,0DAClE,2NAED,kBAAkCA,SAAiB,yJACxCR,SAAS,CAACU,MAAM,CAAwBP,cAAa,CAACK,SAAS,CAAC,CAAC,0DAC3E,0IAfgBH,cAAc"},"metadata":{},"sourceType":"module"}